Bitwise Operations

Allows users to include binary logic in their queries.

With this functionality, users:

  • Apply bitwise AND, OR, XOR and NOT operations on values.

  • Shift bit to left and right in binary digits.

  • Count the number of 1 bits in a value’s binary representation.

Generic syntax:

| process eval("x=binary_and(1,1)")

binary_and

Accepts two or more integers and applies binary AND on them.

Example:

| process eval("and_value=binary_and(1,1)")
_images/binary_and_07_2025.png

Using binary_and function

Here, each bit of the first operand is compared with the corresponding bit of the second operand. If both bits are 1, corresponding result bit is set to 1, otherwise the corresponding result bit is set to 0.

binary_or

Accepts two or more integers and applies binary OR on them.

Example:

| process eval("or_value=binary_or(0,6)")
_images/binary_or_07_2025.png

Using binary_or function

Here, each bit of the first operand is compared with the corresponding bit of the second operand. If both bits are 0, corresponding result bit is set to 0, otherwise the corresponding result bit is set to 1.

binary_not

Takes a non-negative integer as an argument and inverts every bit in the binary representation of that number.

Example:

| process eval("not_value=binary_not(0)")
_images/binary_not_07_2025.png

Using binary_not function

binary_xor

Takes two or more nonnegative integers as arguments and sequentially applies bitwise XOR operations on each of the given arguments.

Example:

| process eval("xor_value=binary_xor(5,10)")
_images/binary_xor_07_2025.png

Using binary_xor function

binary_right_shift

Takes two valid nonnegative integers as arguments and shifts the binary representation of the first integer over to the right by the specified shift offset amount.

Example:

| process eval("right_shift_value=binary_right_shift(9,1)")
_images/right_shift_07_2025.png

Using binary_right_shift function

binary_left_shift

Takes two valid nonnegative integers as arguments and shifts the binary representation of the first integer over to the left by the specified shift offset amount.

Example:

| process eval("left_shift_value=binary_left_shift(9,1)")
_images/left_shift_07_2025.png

Using binary_left_shift function

binary_count_ones

Counts the number of 1’s in a binary number.

Example:

| process eval("binary_count_value=binary_count_ones(12)")
_images/binary_count_07_2025.png

Using binary_count_ones function


Helpful?

We are glad this guide helped.


Please don't include any personal information in your comment

Contact Support